function residual = static_resid(T, y, x, params, T_flag)
% function residual = static_resid(T, y, x, params, T_flag)
%
% File created by Dynare Preprocessor from .mod file
%
% Inputs:
%   T         [#temp variables by 1]  double   vector of temporary terms to be filled by function
%   y         [M_.endo_nbr by 1]      double   vector of endogenous variables in declaration order
%   x         [M_.exo_nbr by 1]       double   vector of exogenous variables in declaration order
%   params    [M_.param_nbr by 1]     double   vector of parameter values in declaration order
%                                              to evaluate the model
%   T_flag    boolean                 boolean  flag saying whether or not to calculate temporary terms
%
% Output:
%   residual
%

if T_flag
    T = model_file.static_resid_tt(T, y, x, params);
end
residual = zeros(97, 1);
lhs = y(1)^T(1);
rhs = 1-params(1)+params(1)*y(2)^T(1);
residual(1) = lhs - rhs;
lhs = y(2)^(1-params(3));
rhs = (y(1)*exp(y(32)))^(1-params(3));
residual(2) = lhs - rhs;
lhs = y(5);
rhs = T(5)*T(7);
residual(3) = lhs - rhs;
lhs = y(7)^T(8);
rhs = params(9)*y(8)^T(8)+(1-params(9))*exp(T(8)*y(27))*T(9);
residual(4) = lhs - rhs;
lhs = y(3);
rhs = y(5);
residual(5) = lhs - rhs;
lhs = y(14)/y(17);
rhs = params(5)*((params(6)-y(12))/y(7))^T(2);
residual(6) = lhs - rhs;
lhs = y(6);
rhs = T(10)*T(11)*exp((1-params(12))*y(24));
residual(7) = lhs - rhs;
lhs = y(8)+y(10)+y(46);
rhs = y(6);
residual(8) = lhs - rhs;
lhs = y(11)*exp(y(25));
rhs = y(11)*(1-params(13))+y(11)*y(40);
residual(9) = lhs - rhs;
lhs = y(40);
rhs = T(12)*T(13)^(1-1/params(15))+params(19);
residual(10) = lhs - rhs;
lhs = exp(y(13));
rhs = T(14)*(y(42)-y(22)*y(44)+y(23)*(y(40)+1-params(13)-y(10)*y(41)/y(11)));
residual(11) = lhs - rhs;
lhs = y(42);
rhs = y(6)*params(12)*(1-1/params(11))/y(11);
residual(12) = lhs - rhs;
lhs = y(44);
rhs = (-(params(12)/params(11)))/y(11);
residual(13) = lhs - rhs;
lhs = y(41);
rhs = params(18)*T(13)^((-1)/params(15));
residual(14) = lhs - rhs;
lhs = y(3)*exp(y(13));
rhs = 1;
residual(15) = lhs - rhs;
lhs = y(23)*y(41);
rhs = 1;
residual(16) = lhs - rhs;
residual(17) = y(43)-y(14)-y(22)*y(45);
lhs = y(43);
rhs = y(6)*(1-params(12))*(1-1/params(11))/y(12);
residual(18) = lhs - rhs;
lhs = y(45);
rhs = (-((1-params(12))/params(11)))/y(12);
residual(19) = lhs - rhs;
residual(20) = y(22)+(-y(47))-exp(y(25))*y(3)*y(48);
lhs = y(46);
rhs = y(6)*T(15);
residual(21) = lhs - rhs;
lhs = y(47);
rhs = y(6)*exp(y(15)-params(44))*params(14)*(exp(y(15)-params(44))-1);
residual(22) = lhs - rhs;
lhs = y(48);
rhs = y(6)*exp(y(15)-params(44))*(exp(y(15)-params(44))-1)*(-params(14));
residual(23) = lhs - rhs;
lhs = T(16)*exp(y(16));
rhs = 1;
residual(24) = lhs - rhs;
lhs = y(16)-params(45);
rhs = (y(16)-params(45))*params(40)+(y(15)-params(44))*(1-params(40))*params(41)+(1-params(40))*params(42)*log(y(6)/params(46))+params(43)*x(2);
residual(25) = lhs - rhs;
lhs = y(3)*exp(y(21)-y(15))*exp(y(49));
rhs = 1;
residual(26) = lhs - rhs;
lhs = y(18);
rhs = T(17)*T(18);
residual(27) = lhs - rhs;
lhs = y(7)*y(17);
rhs = y(8)+y(28)*y(18);
residual(28) = lhs - rhs;
lhs = y(20);
rhs = y(15);
residual(29) = lhs - rhs;
lhs = y(19);
rhs = y(15);
residual(30) = lhs - rhs;
lhs = exp(y(21));
rhs = exp(y(15));
residual(31) = lhs - rhs;
residual(32) = y(29);
lhs = y(24);
rhs = (1-params(24))*params(25)+y(24)*params(24)+params(23)*params(27)*exp(y(26))*x(1);
residual(33) = lhs - rhs;
lhs = y(25);
rhs = (1-params(16))*params(8)+y(25)*params(16)+x(1)*exp(y(26))*params(27)*params(17);
residual(34) = lhs - rhs;
lhs = log(y(28));
rhs = (1-params(35))*log(params(48))+log(y(28))*params(35)+params(33)*sqrt(1-params(35)^2)*x(3);
residual(35) = lhs - rhs;
lhs = y(30);
rhs = y(27);
residual(36) = lhs - rhs;
lhs = y(27);
rhs = y(27)*params(36)+y(30)*params(37)+params(34)*x(4)+x(1)*params(38);
residual(37) = lhs - rhs;
lhs = y(26);
rhs = y(26)*params(26)+params(28)*x(6)-x(1)*params(27)*params(30);
residual(38) = lhs - rhs;
lhs = y(50);
rhs = y(6)-y(14)*y(12)-y(10)-y(46);
residual(39) = lhs - rhs;
lhs = y(51);
rhs = y(50)+y(28)*y(18)*params(39);
residual(40) = lhs - rhs;
lhs = y(52);
rhs = y(25);
residual(41) = lhs - rhs;
lhs = y(54);
rhs = y(15)+y(52)-y(21);
residual(42) = lhs - rhs;
lhs = y(53);
rhs = y(21)+y(54);
residual(43) = lhs - rhs;
lhs = y(55);
rhs = y(25);
residual(44) = lhs - rhs;
lhs = y(57);
rhs = y(15)+y(55)-y(21);
residual(45) = lhs - rhs;
lhs = y(56);
rhs = y(21)+y(57);
residual(46) = lhs - rhs;
lhs = exp(y(58));
rhs = y(3)*(1+exp(y(58)))*exp(y(52));
residual(47) = lhs - rhs;
lhs = exp(y(60));
rhs = (1+exp(y(58)))*exp(y(52))/exp(y(58));
residual(48) = lhs - rhs;
lhs = exp(y(61));
rhs = (1+exp(y(58)))*exp(y(54))/exp(y(58));
residual(49) = lhs - rhs;
lhs = exp(y(59));
rhs = y(3)*(1+exp(y(59)))*exp(y(55));
residual(50) = lhs - rhs;
lhs = exp(y(62));
rhs = (1+exp(y(59)))*exp(y(55))/exp(y(59));
residual(51) = lhs - rhs;
lhs = exp(y(64));
rhs = (1+exp(y(59)))*exp(y(57))/exp(y(59));
residual(52) = lhs - rhs;
lhs = exp(y(63));
rhs = (1+exp(y(59)))*exp(y(56))/exp(y(59));
residual(53) = lhs - rhs;
lhs = y(65);
rhs = log(exp(y(49))+params(20)*(exp(y(61))-exp(y(49))))+params(32)*x(5);
residual(54) = lhs - rhs;
lhs = y(94);
rhs = params(32)*x(5)+log(exp(y(49))+params(20)*(exp(y(64))-exp(y(49))));
residual(55) = lhs - rhs;
lhs = y(66);
rhs = y(65)-y(49);
residual(56) = lhs - rhs;
lhs = y(95);
rhs = y(94)-y(49);
residual(57) = lhs - rhs;
lhs = y(4);
rhs = log(y(3));
residual(58) = lhs - rhs;
lhs = T(16)*y(87);
rhs = y(3)*y(18);
residual(59) = lhs - rhs;
lhs = exp((-2)*y(67));
rhs = T(16)*exp((-y(16)));
residual(60) = lhs - rhs;
lhs = exp((-3)*y(68));
rhs = T(16)*exp((-2)*y(67));
residual(61) = lhs - rhs;
lhs = exp((-4)*y(69));
rhs = T(16)*exp((-3)*y(68));
residual(62) = lhs - rhs;
lhs = exp((-5)*y(70));
rhs = T(16)*exp((-4)*y(69));
residual(63) = lhs - rhs;
lhs = exp((-6)*y(71));
rhs = T(16)*exp((-5)*y(70));
residual(64) = lhs - rhs;
lhs = exp((-7)*y(72));
rhs = T(16)*exp((-6)*y(71));
residual(65) = lhs - rhs;
lhs = exp((-8)*y(73));
rhs = T(16)*exp((-7)*y(72));
residual(66) = lhs - rhs;
lhs = exp((-9)*y(74));
rhs = T(16)*exp((-8)*y(73));
residual(67) = lhs - rhs;
lhs = exp((-10)*y(75));
rhs = T(16)*exp((-9)*y(74));
residual(68) = lhs - rhs;
lhs = exp((-11)*y(76));
rhs = T(16)*exp((-10)*y(75));
residual(69) = lhs - rhs;
lhs = exp((-12)*y(77));
rhs = T(16)*exp((-11)*y(76));
residual(70) = lhs - rhs;
lhs = exp((-13)*y(78));
rhs = T(16)*exp((-12)*y(77));
residual(71) = lhs - rhs;
lhs = exp((-14)*y(79));
rhs = T(16)*exp((-13)*y(78));
residual(72) = lhs - rhs;
lhs = exp((-15)*y(80));
rhs = T(16)*exp((-14)*y(79));
residual(73) = lhs - rhs;
lhs = exp((-16)*y(81));
rhs = T(16)*exp((-15)*y(80));
residual(74) = lhs - rhs;
lhs = exp((-17)*y(82));
rhs = T(16)*exp((-16)*y(81));
residual(75) = lhs - rhs;
lhs = exp((-18)*y(83));
rhs = T(16)*exp((-17)*y(82));
residual(76) = lhs - rhs;
lhs = exp((-19)*y(84));
rhs = T(16)*exp((-18)*y(83));
residual(77) = lhs - rhs;
lhs = exp((-20)*y(85));
rhs = T(16)*exp((-19)*y(84));
residual(78) = lhs - rhs;
lhs = y(86);
rhs = y(85)-y(16);
residual(79) = lhs - rhs;
lhs = y(31);
rhs = y(25);
residual(80) = lhs - rhs;
lhs = y(33);
rhs = y(25);
residual(81) = lhs - rhs;
lhs = y(34);
rhs = y(25);
residual(82) = lhs - rhs;
lhs = y(36);
rhs = y(25);
residual(83) = lhs - rhs;
lhs = y(37);
rhs = y(36);
residual(84) = lhs - rhs;
lhs = y(9);
rhs = T(20)^(params(4)/(params(4)-1));
residual(85) = lhs - rhs;
lhs = y(32);
rhs = y(25);
residual(86) = lhs - rhs;
lhs = y(35);
rhs = y(31)+y(19)-y(21);
residual(87) = lhs - rhs;
lhs = y(38);
rhs = y(15)+y(25)-y(21);
residual(88) = lhs - rhs;
lhs = y(39);
rhs = y(15)+y(25)-y(21);
residual(89) = lhs - rhs;
lhs = y(88);
rhs = y(57)+y(88)*params(21);
residual(90) = lhs - rhs;
lhs = y(89);
rhs = y(62)+params(21)*y(89);
residual(91) = lhs - rhs;
lhs = y(90);
rhs = y(56)+params(21)*y(90);
residual(92) = lhs - rhs;
lhs = y(91);
rhs = y(63)+params(21)*y(91);
residual(93) = lhs - rhs;
lhs = y(92);
rhs = y(49)+params(21)*y(92);
residual(94) = lhs - rhs;
lhs = y(93);
rhs = y(16)+params(21)*y(93);
residual(95) = lhs - rhs;
lhs = y(96);
rhs = y(64);
residual(96) = lhs - rhs;
lhs = y(97);
rhs = y(63);
residual(97) = lhs - rhs;
if ~isreal(residual)
  residual = real(residual)+imag(residual).^2;
end
end
